package common

import (
	execCommon "hundsun.com/hsl/hschain/executor/common"
	"hundsun.com/hsl/hschain/protos/execute"
)

//智能合约的基类
const (
	//合约基类名
	BaseContractClassName   = "com/hundsun/hsl2/basecontract/ContractChecker/ContractTemplate"
	MainDaoName             = "com/hundsun/hsl2/basecontract/dao/MainDao"
	MainDaoInvokeMethodName = "invokeMethod"
	//ESDao接口类名和方法
	ESDaoClassName = "com/hundsun/hsl2/basecontract/dao/ESDao"
	//ESDaoGetMethodName                    = "getPrivate"
	ESDaoGetMethodName = "get"
	//ESDaoPutMethodName                    = "putPrivate"
	ESDaoPutMethodName = "put"
	//Storage注解类名
	StorageAnnotationClassName = "Lcom/hundsun/hsl2/basecontract/annotation/Storage;"
	//Event注解类名
	EventAnnotationClassName = "Lcom/hundsun/hsl2/basecontract/annotation/Event;"
	EventMethodName          = "eventPrivate"
	//EventMethodName                       = "event"
	//Transfer转账
	TransferClassName  = "com/hundsun/hsl2/basecontract/dao/TransferDao"
	TransferMethodName = "transfer"
	//获取当前交易信息
	TxDaoClassName                = "com/hundsun/hsl2/basecontract/dao/TxDao"
	TxDaoGetBlockNumberMethodName = "getBlockNumber"
	TxDaoGetValueMethodName       = "getValue"
	TxDaoGetBlockTimeMethodName   = "getBlockTime"
	TxDaoGetFromMethodName        = "getFrom"
	CreateContractNameSpace       = "CreateContract"
	ContractVersionSpace          = "ContractVersion"
)

type ChkCodeErrCode int32

const (
	ChkCodeErrCodeOk                             ChkCodeErrCode = 0
	ChkCodeErrCodeUseNotAllowClass               ChkCodeErrCode = 1
	ChkCodeErrCodeMainClassNotExpendBaseContract ChkCodeErrCode = 2
	ChkCodeErrCodeClassExpendBaseContract        ChkCodeErrCode = 3
	ChkCodeErrCodeMainClassNotExist              ChkCodeErrCode = 4
	ChkCodeErrCodeUseNative                                     = 5
	ChkCodeErrCodeUseSynchronized                               = 6
	ChkCodeErrCodeImportThirdJarPak                             = 7
	ChkCodeErrCodeNotSupportLanguage                            = 8
	ChkCodeErrCodeClassRecursiveDefined                         = 9
	ChkCodeErrCodeOther                          ChkCodeErrCode = 10
)

type JvmRunErrCode int32

const (
	JvmRunErrCodeOk             JvmRunErrCode = 0
	JvmRunErrCodeNotSupport     JvmRunErrCode = 1
	JvmRunErrCodeLoadClassErr   JvmRunErrCode = 2
	JvmRunErrCodeThrowExecption JvmRunErrCode = 3
	JvmRunErrCodeOtherReason    JvmRunErrCode = 4
)

type ContractStatusType int32

const (
	ContractStatusTypeField ContractStatusType = 0
	ContractStatusTypeEsdao ContractStatusType = 1
)

//传入虚拟机的运行上下文
type VMRunContext struct {
	GroupedTx       *execute.GroupedTransaction
	ContractAddress string
	ExecCtx         *execCommon.ExecContent
	//合约创建初始化
	DeployInit bool
}
